<template>
  <div class="communityDetailWrapper">
    <div class="info">
      <img
        class="img"
        :src="require('~/assets/images/background.jpg')"
        width="200"
        height="200"
        alt="avatar"
      />
      <div class="right">
        <p class="username">CryptoCoders</p>
        <p class="address">邀请链接</p>
        <p class="copyAddress">
          <span class="address">邀请链接</span>
          <CustomCopy :copyConfig="{ copyText: '邀请链接' }" />
        </p>
        <p class="followerOrFollowing">
          <span class="number">120K</span>
          <span class="followers">Members</span>
          <span class="divider"></span>
          <span class="number">120K</span>
          <span class="following">Following</span>
          <span class="divider"></span>
          <span class="number">120K</span>
          <span class="invitated">Invitates</span>
          <span class="divider"></span>
          <span class="toChat">To Chat</span>
          <span class="divider"></span>
          <span class="toChat">Follow</span>
        </p>
      </div>
    </div>
    <div class="content">
      <div class="left">
        <h2>Chat on chains</h2>
        <ul class="ulLeft">
          <li class="ulLi" v-for="(item, index) in 100" :key="index">
            <p class="date">{{ getDateTime(new Date()) }}</p>
            <p class="item">mint xxx nft, 去购买</p>
            <p class="item">buy xxx token, 去购买</p>
          </li>
        </ul>
      </div>
      <div class="right">
        <h2>Members</h2>
        <ul class="list">
          <li v-for="(item, index) in 10" :key="index">
            <div class="liImage">
              <img :src="require('~/assets/images/1.png')" width="45" height="45" alt="avatar" />
              <div class="liInfo">
                <div class="name">CryptoCode</div>
                <div class="wallet">
                  <span>
                    {{
                    getAddress('0xd59E42897299f7856B46eD9cD77CDf9DB9cCB99e')
                    }}
                  </span>
                </div>
              </div>
            </div>
            <el-button type="text">Follow</el-button>
          </li>
        </ul>
      </div>
    </div>
  </div>
</template>

<script lang="ts">
import { Component, Vue } from 'nuxt-property-decorator'
import CustomCopy from '~/components/common/CustomCopy.vue'
import { FormateDate } from '@/utils/dayjs'
import { getOmittedAddress } from '~/utils/getOmittedAddress'
@Component({
  layout: 'space',
  components: {
    CustomCopy,
  },
})
export default class CommunityDetail extends Vue {
  getDateTime(date: Date) {
    return FormateDate.getFullYearDate(date)
  }

  getAddress(val: string) {
    return getOmittedAddress(val)
  }
}
</script>

<style lang="scss" scoped>
.communityDetailWrapper {
  .info {
    justify-content: center;
    align-items: center;
    display: flex;
    height: 500px;
    background-repeat: no-repeat;
    background-size: cover;
    background-position: center;
    background-image: linear-gradient(#304352 0%, rgba(0, 0, 0, 0) 100%),
      url('@/assets/images/background.jpg');
    &::before {
      content: '';
      width: 100%;
      height: 100%;
      position: absolute;
      z-index: -1;
      top: 0;
      left: 0;
      backdrop-filter: blur(10px);
    }

    .img {
      cursor: pointer;
      border-radius: 50%;
      transform: rotate(360deg);
      animation: rotation 3s linear infinite;
    }
    @keyframes rotation {
      from {
        transform: rotate(0deg);
      }

      to {
        transform: rotate(360deg);
      }
    }
    .right {
      padding-left: 40px;
      p.username {
        font-size: 36px;
        color: #fff;
      }
      p.address {
        font-size: 24px;
        color: #fff;
        padding: 10px 0;
      }
      p.copyAddress {
        margin-bottom: 10px;
        width: 140px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        background-color: #0e0f10;
        padding: 5px 10px;
        border-radius: 5px;
        span.address {
          color: #fff;
          font-size: 16px;
        }
      }
      .followerOrFollowing {
        display: flex;
        align-items: center;
        .number {
          font-size: 20px;
          color: #fff;
        }
        .followers,
        .following,
        .invitated {
          margin-left: 10px;
          cursor: pointer;
          font-size: 16px;
          color: #03e9f4;
          &:hover {
            color: #03e9f4;
            text-decoration: underline;
          }
        }

        .divider {
          display: inline-block;
          width: 1px;
          height: 15px;
          margin: 0 20px;
          background-color: #fff;
        }

        .toChat {
          color: #03e9f4;
          cursor: pointer;
          font-size: 16px;
          &:hover {
            color: #03e9f4;
            text-decoration: underline;
          }
        }
      }
    }
  }

  .content {
    width: 62.5%;
    margin: 0 auto;
    display: flex;
    .left {
      box-sizing: border-box;
      width: calc(100% - 400px);
      padding: 30px;
      overflow: hidden;
      h2 {
        color: #fff;
      }
      ul.ulLeft {
        height: 500px;
        overflow-y: scroll;

        li.ulLi {
          .date {
            padding-top: 30px;
            color: #fff;
          }
          .item {
            padding: 10px 0;
          }
        }
      }
    }
    .right {
      width: 400px;
      height: 100%;
      h2 {
        padding-bottom: 10px;
        padding-top: 30px;
        color: #fff;
      }
      ul {
        padding-right: 20px;
        height: 500px;
        overflow: hidden;
        overflow-y: scroll;
        li {
          margin-bottom: 20px;
          display: flex;
          justify-content: space-between;
          align-items: center;
          ::v-deep .el-button {
            color: #03e9f4;

            &:hover {
              color: #03e9f4;
              text-decoration: underline;
            }
          }
          .liImage {
            display: flex;
            align-items: center;
            img {
              border-radius: 50%;
            }
          }
          .liInfo {
            padding-left: 10px;
            .name {
              color: #fff;
              padding-bottom: 5px;
            }
          }
        }
      }
    }
  }
}
</style>
